package com.nbsaas.boot.app.rest.convert;

import com.nbsaas.boot.app.data.entity.AppRoleMenu;
import com.nbsaas.boot.app.api.domain.simple.AppRoleMenuSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* 角色-列表对象转换器
*/

public class AppRoleMenuSimpleConvert implements Converter<AppRoleMenuSimple, AppRoleMenu> {




@Override
public AppRoleMenuSimple convert(AppRoleMenu source) {
    AppRoleMenuSimple result = new AppRoleMenuSimple();


               try {
                   if(source.getApp()!=null){
                       result.setApp(source.getApp().getId());
                   }
                } catch (Exception ignored) { }


               try {
                   if(source.getRole()!=null){
                       result.setRole(source.getRole().getId());
                   }
                } catch (Exception ignored) { }


                try {
                    if(source.getApp()!=null){
                        result.setAppName(source.getApp().getName());
                    }
                } catch (Exception ignored) { }


                try {
                    if(source.getRole()!=null){
                        result.setRoleName(source.getRole().getName());
                    }
                } catch (Exception ignored) { }


                try {
                    if(source.getMenu()!=null){
                        result.setMenuName(source.getMenu().getName());
                    }
                } catch (Exception ignored) { }

                result.setId(source.getId());

               try {
                   if(source.getMenu()!=null){
                       result.setMenu(source.getMenu().getId());
                   }
                } catch (Exception ignored) { }



    return result;
}

}